import math

def LogSanjiao(cls):
    class wrapper(cls):
        def __init__(self,*args,**kwargs):
            self.wrapped=cls(*args,**kwargs)

        def __getattr__(self, item):
            print("获得了三角形的某一条边：",item)
            return getattr(self.wrapped,item)

        def __setattr__(self, key, value):
            if key == 'wrapped':
                # 第一次初始化时允许
                super().__setattr__(key, value)
            else:
                setattr(self.wrapped, key, value)
        def circumference(self):
            print("调用边长之前：")
            return self.wrapped.circumference()
        def display(self):
            print(f"这是一个三角形，三边长是a={self.wrapped.a}，b={self.wrapped.b},c={self.wrapped.c}")
    return wrapper

#三角形,边长单位是米
@LogSanjiao
class Triangle:
    def __init__(self,a:float,b:float,c:float):
        self.a=a
        self.b=b
        self.c=c
    def circumference(self):
        return self.a+self.b+self.c
    def area(self):
        p=self.circumference()/2
        return (p*(p-self.a)*(p-self.b)*(p-self.c))**0.5

if __name__ == '__main__':
    t=Triangle(10,12,15)
    t.a=14#???
    print(t.circumference())
    print(t.area())
    t.display()